#include <iostream>
using namespace std;

/*
int func(int x){
    int count=0;
    while (x)
    {
       count++;
      x=x&(x-1);//与运算
    }
      return count;
}
*/

int main()
{
    int num;
    while(cin >> num){
        if(num < 1){
            cout << 0 << endl;
            return 0;
        }
            
        int cnt = 0;
        while(num){
            if(num & 1)
                ++cnt;
            num >>= 1;
        }
        cout << cnt << endl;
        }
    
    return 0;
}